package com.recource.domain;

import com.recource.vo.FileVO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * @author yujie
 * @createTime 2022/11/26 11:35
 * @description
 */
@Data
@TableName(value = "t_file")
public class FileAssets {

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    @TableField(value = "name")
    private String name;

    @TableField(value = "flod")
    private String flod;

    @TableField(value = "file_key")
    private String fileKey;

    @TableField(value = "file_type")
    private String fileType;

    @TableField(value = "time")
    private Date time = new Date();

    public static FileVO makeVO(FileAssets fileAssets){
        if (Objects.nonNull(fileAssets)) {
            FileVO vo = new FileVO();
            vo.setCode(fileAssets.getId());
            vo.setName(fileAssets.getName());
            vo.setFileType(fileAssets.getFileType());
            return vo;
        }else{
            return new FileVO();
        }
    }

}
